<%@ page import="java.util.ArrayList" %>
<%@ page import="Model.ScoreBean" %>
<%@ page import="Model.Score" %><%--
  Created by IntelliJ IDEA.
  User: 吴倩
  Date: 2022/12/3
  Time: 1:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% application.setAttribute("path",request.getContextPath());%>
<jsp:useBean id="scoreBean" class="Model.ScoreBean" scope="session"/>
<html>
<head>
    <title>查看颁奖</title>
    <link rel="stylesheet" href="../css/index.css" type="text/css">
</head>
<%
    String name = (String) session.getAttribute("name");
    ScoreBean db=(ScoreBean) session.getAttribute("scoreBean");
    ArrayList<Score> d;
    d = db.getScoreArrayList();
%>
<body>
<div>

    <div class="head">
        <div class="headOne">
            <p id="system">运动会管理系统</p>
        </div>

        <div class="headThree">
            <div class="info" style="margin-top: 10px">
                <%--                <img src="../image/样式.png" alt="图片加载失败！">--%>
            </div>

            <div class="manager">
                <div id="manager_one">
                    <img src="../image2/管理员.png" alt="图片加载失败" width="30px">
                </div>
                <div id="manager_two">
                    <div style="font-size: 20px;color:white;"><%=name%></div>
                </div>
            </div>

            <div class="quit">
                <a class="quit" href="../jsp/login.jsp">☛退 出 登 录</a>
            </div>
        </div>
    </div>
    <div class="body_one">
        <div class="function1">
            🚀功能菜单
        </div>
        <div class="operating">
            <img src="../image/搜索.png" alt="加载失败" width="25px">&nbsp;&nbsp;<span><a href="../LookSportServlet">查询运动项目</a></span><br><br>
            <img src="../image/替换.png" alt="加载失败">&nbsp;&nbsp;&nbsp;<span><a href="add_sport.jsp">添加运动项目</a></span><br><br>
            <img src="../image/搜索.png" alt="加载失败">&nbsp;<span><a href="update_sport1.jsp">修改运动项目</a></span><br><br>
            <br>
            <br>
            <img src="../image/搜索.png" alt="加载失败" width="25px">&nbsp;&nbsp;<span><a href="release_score1.jsp">公布成绩</a></span><br><br>
            <img src="../image2/比例.png" alt="加载失败">&nbsp;<span><a href="banjiang.jsp">奖项颁布</a></span><br><br>
        </div>
    </div>
    <div class="body_two">
        <div class="body_head">
            <div class="home">
                <a href="admin_index.jsp"><img src="../image/主页.png" alt="图片加载失败！"></a>
            </div>
            <div class="drop">
                <img src="../image2/下拉条.png" alt="图片加载失败！">
            </div>
        </div>

        <%
            if (d.size()==0){
                response.getWriter().write("<script language='javascript'>alert('暂无颁奖信息！');" +
                        "window.location.href='/admin/banjiang.jsp';</script>");
            }else{
                int one=0,two=0,three=0;
                for (int i=0;i<d.size();i++){
                    if (d.get(i).getRank() == 1){
                        one = i+1;
                    }
                    if (d.get(i).getRank() == 2){
                        two = i+1;
                    }
                    if (d.get(i).getRank() == 3){
                        three = i+1;
                    }
                }

                if (one == 0 || two == 0 || three == 0){
                    response.getWriter().write("<script language='javascript'>alert('暂无颁奖信息！');" +
                            "window.location.href='/admin/banjiang.jsp';</script>");
                }else {
                    one -= 1;
                    two -= 1;
                    three -= 1;

                    out.print("<div class=\"body_tail\" >");
                    out.print("<p style=\"font-size: larger;text-align: center;\">");
                    out.print("金奖<br>");
                    out.print("学号："+d.get(one).getId()+"<br>");
                    out.print("姓名："+d.get(one).getName()+"<br>");
                    out.print("学院："+d.get(one).getDept()+"<br>");
                    out.print("班级："+d.get(one).getSporter_class()+"<br>");
                    out.print("成绩："+d.get(one).getGrade()+"<br>");
                    out.print("</p>");
                    out.print("<p style=\"font-size: larger;text-align: center;\">");
                    out.print("银奖<br>");
                    out.print("学号："+d.get(two).getId()+"<br>");
                    out.print("姓名："+d.get(two).getName()+"<br>");
                    out.print("学院："+d.get(two).getDept()+"<br>");
                    out.print("班级："+d.get(two).getSporter_class()+"<br>");
                    out.print("成绩："+d.get(two).getGrade()+"<br>");
                    out.print("</p>");
                    out.print("<p style=\"font-size: larger;text-align: center;\">");
                    out.print("铜奖<br>");
                    out.print("学号："+d.get(three).getId()+"<br>");
                    out.print("姓名："+d.get(three).getName()+"<br>");
                    out.print("学院："+d.get(three).getDept()+"<br>");
                    out.print("班级："+d.get(three).getSporter_class()+"<br>");
                    out.print("成绩："+d.get(three).getGrade()+"<br>");
                    out.print("</p>");
                    out.print("</div>");
                }
            }
        %>

<%--        <div class="body_tail" >--%>
<%--            <p style="font-size: larger;text-align: center;">--%>
<%--                金奖<br>--%>
<%--                学号：<%=d.get(one).getId()%><br>--%>
<%--                姓名：<%=d.get(one).getName()%><br>--%>
<%--                学院：<%=d.get(one).getDept()%><br>--%>
<%--                班级：<%=d.get(one).getSporter_class()%><br>--%>
<%--                成绩：<%=d.get(one).getGrade()%><br>--%>
<%--            </p>--%>
<%--            <p style="font-size: larger;text-align: center;">--%>
<%--                银奖<br>--%>
<%--                学号：<%=d.get(two).getId()%><br>--%>
<%--                姓名：<%=d.get(two).getName()%><br>--%>
<%--                学院：<%=d.get(two).getDept()%><br>--%>
<%--                班级：<%=d.get(two).getSporter_class()%><br>--%>
<%--                成绩：<%=d.get(two).getGrade()%><br>--%>
<%--            </p>--%>
<%--            <p style="font-size: larger;text-align: center;">--%>
<%--                铜奖<br>--%>
<%--                学号：<%=d.get(three).getId()%><br>--%>
<%--                姓名：<%=d.get(three).getName()%><br>--%>
<%--                学院：<%=d.get(three).getDept()%><br>--%>
<%--                班级：<%=d.get(three).getSporter_class()%><br>--%>
<%--                成绩：<%=d.get(three).getGrade()%><br>--%>
<%--            </p>--%>
<%--        </div>--%>
    </div>
</div>
</body>
</html>
